﻿<Window x:Uid="Window_1" x:Class="Arma3LauncherWPF.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Arma3LauncherWPF.Converters"
        xmlns:res="clr-namespace:Arma3LauncherWPF.Properties"
        xmlns:tb="http://www.hardcodet.net/taskbar" 

        Title="{x:Static res:Resources.App_Title}" Height="450" Width="550" MinHeight="750" MinWidth="550"
        WindowStyle="SingleBorderWindow" WindowStartupLocation="CenterScreen" Loaded="Window_Loaded"
        
        Icon="up_down.ico" ResizeMode="CanResizeWithGrip">
    <Window.Resources>
        <local:InverseBooleanConverter x:Uid="local:InverseBooleanConverter_1" x:Key="InverseBooleanConverter" />
        <local:BrushColorConverter x:Uid="local:BrushColorConverter_1" x:Key="BrushColorConverter" />
        <local:BoolToVisibilityConverter x:Uid="local:BoolToVisibilityConverter_1" x:Key="BoolToVisibilityConverter" />
        <local:ServerAddressToVisibilityConverter x:Uid="local:ServerAddressToVisibilityConverter_1" x:Key="ServerAddressToVisibilityConverter" />
        
    </Window.Resources>
    <Grid x:Uid="Grid_1">
        <Grid.RowDefinitions>
            <RowDefinition x:Uid="RowDefinition_1" Height="Auto"></RowDefinition>
            <RowDefinition x:Uid="RowDefinition_2" Height="*"></RowDefinition>
            <RowDefinition x:Uid="RowDefinition_1" Height="Auto"></RowDefinition>
            <RowDefinition x:Uid="RowDefinition_3" Height="75"></RowDefinition>
        </Grid.RowDefinitions>
        <ToolBar x:Uid="ToolBar_1">
            <Button x:Uid="Button_1" Click="ButtonBase_OnClickRefresh">
                <Image x:Uid="Image_1" Source="Icons/refresh.ico" Height="16" Width="16"></Image>
            </Button>

            <ComboBox x:Uid="ComboBox_1" Margin="5, 0" VerticalAlignment="Bottom" Grid.Row="1" Grid.Column="0" Width="160" Height="25" ItemsSource="{Binding Profiles}"
                      SelectedValue="{Binding CurrentProfile, Mode=TwoWay}"></ComboBox>

            <Button x:Uid="Button_2" Click="Button_Add">
                <Image x:Uid="Image_2" Source="Icons/add.ico" ToolTip="{x:Static res:Resources.Add}" Height="16" Width="16"></Image>
            </Button>

            <Button x:Uid="Button_3" Click="Button_Save">
                <Image x:Uid="Image_3" Source="Icons/save 2.ico" ToolTip="{x:Static res:Resources.Save}" Height="16" Width="16"></Image>
            </Button>

            <Button x:Uid="Button_4" Click="Button_Delete" IsEnabled="{Binding CurrentProfile.CanDelete}">
                <Image x:Uid="Image_4" Source="Icons/delete.ico" ToolTip="{x:Static res:Resources.Delete}" Height="16" Width="16"></Image>
            </Button>

            <Button x:Uid="Button_5" Click="Button_Settings">
                <Image x:Uid="Image_4" Source="Icons/gear.png" ToolTip="{x:Static res:Resources.Settings}" Height="16" Width="16"></Image>
            </Button>

        </ToolBar>
        <TabControl x:Uid="TabControl_1" Grid.Row="1" HorizontalAlignment="Stretch" Margin="10,10,10,10" VerticalAlignment="Stretch" HorizontalContentAlignment="Stretch"  >
            <TabItem x:Uid="TabItem_1" Header="{x:Static res:Resources.Mod_Tab_Title}" IsSelected="True" >
                <Grid x:Uid="Grid_2" Background="#FFE5E5E5"  >
                    <ListView  x:Uid="ListView_1" ItemsSource="{Binding ModsForProfile, Mode=OneWay}">
                        <ListView.View>
                            <GridView x:Uid="GridView_1">
                                <GridView.Columns>
                                    <GridViewColumn x:Uid="GridViewColumn_1">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate x:Uid="DataTemplate_1">
                                                <CheckBox x:Uid="CheckBox_1" IsChecked="{Binding IsChecked, Mode=TwoWay}" IsEnabled="{Binding Path=DataContext.CurrentProfile.CanEdit , RelativeSource={RelativeSource AncestorType=Window}}"/>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>

                                    <GridViewColumn x:Uid="GridViewColumn_2" Header="{x:Static res:Resources.Name}">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate x:Uid="DataTemplate_2">
                                                <Label x:Uid="Label_1" Content="{Binding ModInfo.ModName}" Foreground="{Binding Downloaded, Converter={StaticResource BrushColorConverter}}"></Label>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>

                                    <GridViewColumn x:Uid="GridViewColumn_3" Header="{x:Static res:Resources.Downloaded}">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate x:Uid="DataTemplate_3">
                                                <CheckBox x:Uid="CheckBox_2" IsChecked="{Binding Downloaded, Mode=OneWay}" IsEnabled="False"/>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>

                                    <GridViewColumn x:Uid="GridViewColumn_4">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate x:Uid="DataTemplate_4">
                                                <Button  x:Uid="Button_5" IsEnabled="{Binding CanDownload, Mode=OneWay}"
                                                        Visibility="{Binding CanDownload, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
                                                        Click="ButtonBase_OnClick" Content="{x:Static res:Resources.Download}">
                                                </Button>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>


                                        <GridViewColumn.HeaderTemplate>
                                            <DataTemplate x:Uid="DataTemplate_5">
                                                <Button  x:Uid="Button_6" Click="ButtonBase_DownloadAll" Content="{x:Static res:Resources.DownloadAll}">
                                                </Button>
                                            </DataTemplate>
                                        </GridViewColumn.HeaderTemplate>


                                    </GridViewColumn>

                                    <GridViewColumn x:Uid="GridViewColumn_5">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate x:Uid="DataTemplate_6">
                                                <Button x:Uid="Button_7" IsEnabled="{Binding CanUpdate, Mode=OneWay}" Content="{x:Static res:Resources.Update}"
                                                        Visibility="{Binding CanUpdate, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
                                                        Click="ButtonBase_Update">
                                                </Button>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>

                                        <GridViewColumn.HeaderTemplate>
                                            <DataTemplate x:Uid="DataTemplate_7">
                                                <Button  x:Uid="Button_8" Click="ButtonBase_UpdateAll" Content="{x:Static res:Resources.UpdateAll}">
                                                </Button>
                                            </DataTemplate>
                                        </GridViewColumn.HeaderTemplate>

                                    </GridViewColumn>

                                    <!--<GridViewColumn x:Uid="GridViewColumn_6">
                                        <GridViewColumn.CellTemplate>
                                            <DataTemplate x:Uid="DataTemplate_8">
                                                <Button x:Uid="Button_9" IsEnabled="{Binding Downloaded, Mode=OneWay}" Content="{x:Static res:Resources.Delete}"
                                                        Visibility="{Binding Downloaded, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}"
                                                        Click="ButtonBase_Delete">
                                                </Button>
                                            </DataTemplate>
                                        </GridViewColumn.CellTemplate>
                                    </GridViewColumn>-->
                                </GridView.Columns>
                                
                            </GridView>
                        </ListView.View>
                    </ListView>
                </Grid>
            </TabItem>
            <TabItem x:Uid="TabItem_2" Header="{x:Static res:Resources.Settings_Tab_Title}">
                <Grid x:Uid="Grid_3" Margin="20">
                    <Grid.RowDefinitions>
                        <RowDefinition x:Uid="RowDefinition_4" Height="Auto"></RowDefinition>
                        <RowDefinition x:Uid="RowDefinition_5" Height="Auto"></RowDefinition>
                        <RowDefinition x:Uid="RowDefinition_6" Height="Auto"></RowDefinition>
                        <RowDefinition x:Uid="RowDefinition_7" Height="Auto"></RowDefinition>
                        <RowDefinition x:Uid="RowDefinition_8" Height="Auto"></RowDefinition>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition x:Uid="ColumnDefinition_1" Width="Auto"></ColumnDefinition>
                        <ColumnDefinition x:Uid="ColumnDefinition_2" Width="Auto"></ColumnDefinition>
                        <ColumnDefinition x:Uid="ColumnDefinition_3" Width="Auto"></ColumnDefinition>
                        <ColumnDefinition x:Uid="ColumnDefinition_4" Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>

                    <CheckBox x:Uid="CheckBox_3" Margin="5" Grid.Row="0" Grid.Column="0" IsChecked="{Binding SettingsDto.NoSplashScreen, Mode=TwoWay}" Content="No Splash Screen" ></CheckBox>
                    <CheckBox x:Uid="CheckBox_4" Margin="5" Grid.Row="1" Grid.Column="0" IsChecked="{Binding SettingsDto.EmptyDefaultWorld, Mode=TwoWay}" Content="Empty Default World" ></CheckBox>
                    <CheckBox x:Uid="CheckBox_5" Margin="5" Grid.Row="2" Grid.Column="0" IsChecked="{Binding SettingsDto.ShowScriptErrors, Mode=TwoWay}" Content="Show Script Error" ></CheckBox>
                    <CheckBox x:Uid="CheckBox_6" Margin="5" Grid.Row="3" Grid.Column="0" IsChecked="{Binding SettingsDto.NoPauseOnTaskSwitch, Mode=TwoWay}"  Content="No Pause On Task Switch" ></CheckBox>
                    <CheckBox x:Uid="CheckBox_7" Margin="5" Grid.Row="4" Grid.Column="0" IsChecked="{Binding SettingsDto.SkipIntro, Mode=TwoWay}"  Content="Skip Intro"></CheckBox>



                    <CheckBox x:Uid="CheckBox_8" Margin="5" Grid.Row="0" Grid.Column="1" IsChecked="{Binding SettingsDto.MaxMemory, Mode=TwoWay}" Content="Max Memory" ></CheckBox>
                    <CheckBox x:Uid="CheckBox_9" Margin="5" Grid.Row="1" Grid.Column="1" IsChecked="{Binding SettingsDto.MaxVRAM, Mode=TwoWay}" Content="Max VRAM" ></CheckBox>
                    <CheckBox x:Uid="CheckBox_10" Margin="5" Grid.Row="2" Grid.Column="1" IsChecked="{Binding SettingsDto.CPUCount, Mode=TwoWay}" Content="CPU Count" ></CheckBox>
                    <CheckBox x:Uid="CheckBox_11" Margin="5" Grid.Row="3" Grid.Column="1" IsChecked="{Binding SettingsDto.ExtraThreads, Mode=TwoWay}"  Content="ExtraThreads" ></CheckBox>

                    <CheckBox x:Uid="CheckBox_12" Margin="5" Grid.Row="4" Grid.Column="1" IsChecked="{Binding SettingsDto.Windowed, Mode=TwoWay}"  Content="Windowed" ></CheckBox>

                    
                    
                    <Slider x:Uid="Slider_1" Margin="5" Grid.Row="0" Grid.Column="2" Width="100" Minimum="256" Maximum="2047" Value="{Binding SettingsDto.MaxMemoryInt,   Mode=TwoWay}" IsEnabled="{Binding SettingsDto.MaxMemory, Mode=OneWay}" IsSnapToTickEnabled="True" TickFrequency="100" />
                    <Slider x:Uid="Slider_2" Margin="5" Grid.Row="1" Grid.Column="2" Width="100" Minimum="127" Maximum="2047" Value="{Binding SettingsDto.MaxVRAMInt,     Mode=TwoWay}" IsEnabled="{Binding SettingsDto.MaxVRAM, Mode=OneWay}" IsSnapToTickEnabled="True" TickFrequency="100" />
                    <Slider x:Uid="CPUCountInt" Margin="5" Grid.Row="2" Grid.Column="2" Width="100" Minimum="256" Maximum="2047" Value="{Binding SettingsDto.CPUCountInt,    Mode=TwoWay}" Name="CPUCountInt" IsEnabled="{Binding SettingsDto.CPUCount, Mode=OneWay}" IsSnapToTickEnabled="True" TickFrequency="1" />
                    <Slider x:Uid="Slider_3" Margin="5" Grid.Row="3" Grid.Column="2" Width="100" Minimum="0" Maximum="7" Ticks="0, 1, 3, 5, 7" Value="{Binding SettingsDto.ExtraThreadsInt, Mode=TwoWay}" IsEnabled="{Binding SettingsDto.ExtraThreads, Mode=OneWay}" IsSnapToTickEnabled="True" TickFrequency="100" />

                    <TextBox  x:Uid="TextBox_1" Margin="5" Grid.Row="0" Grid.Column="3" Text="{Binding SettingsDto.MaxMemoryInt,   Mode=TwoWay}" Width="50" IsEnabled="False" ></TextBox>
                    <TextBox  x:Uid="TextBox_2" Margin="5" Grid.Row="1" Grid.Column="3" Text="{Binding SettingsDto.MaxVRAMInt,     Mode=TwoWay}" Width="50" IsEnabled="False" ></TextBox>
                    <TextBox  x:Uid="TextBox_3" Margin="5" Grid.Row="2" Grid.Column="3" Text="{Binding SettingsDto.CPUCountInt,    Mode=TwoWay}" Width="50" IsEnabled="False" ></TextBox>
                    <TextBox  x:Uid="TextBox_4" Margin="5" Grid.Row="3" Grid.Column="3" Text="{Binding SettingsDto.ExtraThreadsInt, Mode=TwoWay}" Width="50" IsEnabled="False" ></TextBox>



                </Grid>
            </TabItem>
        </TabControl>
       
        <Grid Grid.Row="2" Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition x:Uid="RowDefinition_4" Height="Auto"></RowDefinition>
                <RowDefinition x:Uid="RowDefinition_5" Height="Auto"></RowDefinition>
                <RowDefinition x:Uid="RowDefinition_6" Height="Auto"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition x:Uid="ColumnDefinition_1" Width="Auto"></ColumnDefinition>
                <ColumnDefinition x:Uid="ColumnDefinition_2" Width="Auto"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            
            <Label Grid.Row="0">IP</Label>
            <TextBox Grid.Row="0" Grid.Column="1" Margin="5" Text="{Binding CurrentProfile.ServerAddress.IP, Mode=TwoWay}" IsEnabled="False" Width="200"></TextBox>

            <Label Grid.Row="1">Port</Label>
            <TextBox Grid.Row="1" Grid.Column="1" Margin="5" Text="{Binding CurrentProfile.ServerAddress.Port, Mode=TwoWay}" IsEnabled="False" Width="200"></TextBox>

            <Label Grid.Row="2">Password</Label>
            <TextBox Grid.Row="2" Grid.Column="1" Margin="5" Text="{Binding CurrentProfile.ServerAddress.Password, Mode=TwoWay}" IsEnabled="False" Width="200"></TextBox>
        </Grid>
        
        <Grid x:Uid="Grid_4" Grid.Row="3" Margin="10" VerticalAlignment="Bottom">
            <Grid.ColumnDefinitions>
                <ColumnDefinition x:Uid="ColumnDefinition_5"></ColumnDefinition>
                <ColumnDefinition x:Uid="ColumnDefinition_6" Width="Auto"></ColumnDefinition>
                <ColumnDefinition x:Uid="ColumnDefinition_6" Width="Auto"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <TextBlock x:Uid="TextBlock_1" TextDecorations="">
                <Hyperlink x:Uid="Hyperlink_1" NavigateUri="http://tehgam.com/" RequestNavigate="RequestNavigate"   >
                    <Grid x:Uid="Grid_5" Margin="0"> 
                        <Image x:Uid="Image_5" Source="Icons/bg_header.jpg" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" StretchDirection="Both" Stretch="UniformToFill"></Image>
                        <Image x:Uid="Image_6" Source="Icons/site_logo.png" MaxWidth="130" Margin="0, 15, 0, 10" HorizontalAlignment="Left"  Stretch="Uniform"></Image>
                    </Grid>
                </Hyperlink>
            </TextBlock>
            <Button x:Uid="Button_10" Margin="3, 0" VerticalAlignment="Bottom" Grid.Row="0" Grid.Column="1" FontSize="25" FontWeight="Bold"  Content="{x:Static res:Resources.Run}" Width="100" Height="55" Click="Button_Run"></Button>
            <Button x:Uid="Button_11" Margin="3, 0" VerticalAlignment="Bottom" Grid.Row="0" Grid.Column="2" FontSize="25" FontWeight="Bold"  Content="{x:Static res:Resources.Connect}" Width="100" Height="55" Click="Button_Connect"
                    Visibility="{Binding CurrentProfile.ServerAddress, Mode=OneWay, Converter={StaticResource ServerAddressToVisibilityConverter}}"
                    ></Button>
        </Grid>

        <tb:TaskbarIcon IconSource="up_down.ico" ToolTipText="{x:Static res:Resources.App_Title}" TrayMouseDoubleClick="Tray_Dbl_Click" >
            <tb:TaskbarIcon.ContextMenu>
                <ContextMenu>
                    <MenuItem Header="{x:Static res:Resources.Exit}" Click="Exit_Click"></MenuItem>
                </ContextMenu>
            </tb:TaskbarIcon.ContextMenu>
        </tb:TaskbarIcon>

    </Grid>
</Window>
